Workshop

Column

Executive Summary

Let users interact with your data and your analysis, create interactive supplementary materials for your meetings, papers, reports or posters.

Improve the way you interact with your team.

Do it all with R!

November 5, 2019, at BIO

Workshop led by Dr. Paul Regular, DFO, Newfoundland and Labrador region

Abstract

Scientists across many fields are faced with the challenge of synthesizing and communicating information from large and complex data sets. This growth in data, alongside the computational methods used to integrate it, can make the process of communicating the results to stakeholders and managers in a meaningful way more daunting. The traditional approach of presenting information across a series of static slides and plots often fails to convey the richness of information available and, as such, important patterns and details are easily overlooked.

Dr. Paul Regular and his co-workers in Newfoundland and Labrador region contend that this problem can be mediated through the effective use of new open source tools for building interactive visualizations (e.g. R packages such as flexdashboard, shiny and plotly). These tools allow a broader audience to conduct detailed explorations of the results, leading to a deeper and collective understanding of both the data and models used to inform Science advice. As a consequence, the peer review process is more open and accessible and the resulting science advice is improved and widely supported.

Outcomes of the workshop

This workshop was developed and proposed to promote learning and development relevant for staff in OESD, CESD, SPAD and PED at BIO. Full proposal was submitted in July 2019 and is accesible here: https://docs.google.com/document/d/1uMrd_UhAEI9R4wZ0bFQeYr6ZVFqTe4MA/edit

This workshop enabled us to learn about the use of interactive tools, its role in supporting Science advice, and a discussion of a path-forward to extend this to other approaches in DFO.

This dashboard was created by Paul Regular and Catalina Gomez following the workshop to share resources and tools available at our fingertips. Freya Keyser and Jessica Sameoto contributed with content, and code for the participant evaluation section.

Getting Started

Dashboards in R

Step 1: Watch Paul’s BIO seminar & get inspired: https://drive.google.com/file/d/1XHLmOl6gV4kY5_0STdk42vTarkFI0VzR/view?usp=sharing

Step 2: Watch the TESA webinar: https://www.gcpedia.gc.ca/wiki/DFO_Science_TESA_ETES

Step 3: Download the getting started dashboard to your machine (and use google chrome to visualize this html): https://drive.google.com/file/d/1Nttg8aYjVJLtg_9ndDYnS131pycNbfsh/view?usp=sharing

Step 4: Clone and explore this dashboard to learn about the workshop.

The full repository to create this flashboard is in the Atlantic R GitHub site: https://github.com/AtlanticR/bioRworkshops/tree/master/16_ToolsScienceAdvice

Step 5: Create your own dashboard and share (!)

Agenda



Agenda for workshop on November 5th 2019 distributed to workshop participants:

https://docs.google.com/spreadsheets/d/1rWqus06dRR5TQfTOwpfq9Ul862BvzZ7rG5qXJOSuC-s/edit#gid=0

Pre-workshop material: Shiny!



Intro to Shiny Apps

Chantelle Layton & Clark Richards led a workshop at BIO to learn about Shiny apps in R. Shiny takes a fresh, interactive approach to telling your data story.

Map

Column

Map connected to filters

Leaflet map

Animated map using the plotly frame argument

Plots

Column

Temperature

Markers sized based on total weight captured

Data

Column

Results

Participant evaluation

Column

Summary of post-workshop evaluation results

Workshop participants were asked to complete an evaluation survey at the end of the workshop. Of the 29 attendees, 19 responses were received (65% response rate). Responses were received from participants in the four Science divisions (Figure 1).

Participants were asked to rate the workshop on various factors on a scale of 0-5 (low to high). The minimum rating for any question was 3, and average ratings were all above 4 (Figure 2).

All survey respondents answered that they would recommend this workshop to others. 12 respondents provided comments. They highlighted:

  • the content was interesting and was highly applicable to their work activities
  • they enjoyed engaging with others outside their normal workgroup
  • they felt they learned a lot

All survey respondents answered that they would try the techniques used in the course. 10 respondents provided comments. They highlighted:

  • the communication value of using dashboards with stakeholders or in CSAS processes to improve comprehension and transparency
  • the efficiency of using dashboards to explore and quality control data

There were 8 responses to the question “What were you hoping to learn in this workshop that you did not?” Responses included:

  • mapping
  • presentation methods
  • integrating Shiny into a dashboard format
  • more examples and more time to practice

Participants were asked for suggestions of topics for future workshops. The 8 responses highlighted:

  • cloud computing with RStudio
  • Shiny
  • spatial modelling/analysis
  • Github
  • R package development
  • integrating work between units/divisions

Survey respondents reported that they would be most available for future workshops between November and March (Figure 3).

Column

Figure 1. Survey responses by science division.

Figure 2. Summary of responses to rating questions. Each rating question was answered by 19 respondents.

Figure 3. Participant availability by month.

---
title: "Interactive Tools for Science Advice Workshop"
output: 
  flexdashboard::flex_dashboard:
    source_code: embed
---

```{r setup, include=FALSE}
require(tidyverse)
library(plotly)
library(crosstalk)
library(ggplot2)
library(DT)
library(leaflet)
library(forcats)
library(knitr)
library(reshape2)
library(tidyr)
#library(pandoc)
library(plyr)
rv <- read.csv("RV2010_2018_trim.csv")
rv <- rv[which(rv$SPEC %in% c(10, 30, 2550)), ]
rv$COMM <- factor(rv$COMM)
shared_rv <- SharedData$new(rv)
```

Workshop {data-icon="fa-laptop"}
=======================================

Column {.tabset}
---------------------------------------

### Executive Summary

```{r, out.width = "100%"} knitr::include_graphics("stickers-fish.jpg") ```
Let users interact with your data and your analysis, create interactive supplementary materials for your meetings, papers, reports or posters. Improve the way you interact with your team. Do it all with R! **November 5, 2019, at BIO** Workshop led by Dr. Paul Regular, DFO, Newfoundland and Labrador region #### Abstract Scientists across many fields are faced with the challenge of synthesizing and communicating information from large and complex data sets. This growth in data, alongside the computational methods used to integrate it, can make the process of communicating the results to stakeholders and managers in a meaningful way more daunting. The traditional approach of presenting information across a series of static slides and plots often fails to convey the richness of information available and, as such, important patterns and details are easily overlooked. Dr. Paul Regular and his co-workers in Newfoundland and Labrador region contend that this problem can be mediated through the effective use of new open source tools for building interactive visualizations (e.g. R packages such as `flexdashboard`, `shiny` and `plotly`). These tools allow a broader audience to conduct detailed explorations of the results, leading to a deeper and collective understanding of both the data and models used to inform Science advice. As a consequence, the peer review process is more open and accessible and the resulting science advice is improved and widely supported. #### Outcomes of the workshop This workshop was developed and proposed to promote learning and development relevant for staff in OESD, CESD, SPAD and PED at BIO. Full proposal was submitted in July 2019 and is accesible here: https://docs.google.com/document/d/1uMrd_UhAEI9R4wZ0bFQeYr6ZVFqTe4MA/edit This workshop enabled us to learn about the use of interactive tools, its role in supporting Science advice, and a discussion of a path-forward to extend this to other approaches in DFO. This dashboard was created by Paul Regular and Catalina Gomez following the workshop to share resources and tools available at our fingertips. Freya Keyser and Jessica Sameoto contributed with content, and code for the participant evaluation section.
### Getting Started **Dashboards in R** Step 1: Watch Paul's BIO seminar & get inspired: https://drive.google.com/file/d/1XHLmOl6gV4kY5_0STdk42vTarkFI0VzR/view?usp=sharing Step 2: Watch the TESA webinar: https://www.gcpedia.gc.ca/wiki/DFO_Science_TESA_ETES Step 3: Download the *getting started dashboard* to your machine (and use google chrome to visualize this html): https://drive.google.com/file/d/1Nttg8aYjVJLtg_9ndDYnS131pycNbfsh/view?usp=sharing Step 4: Clone and explore this dashboard to learn about the workshop. - Open Rstudio - File > New Project > Version Control - Git - Clone Git Repository - Repository URL: https://github.com/AtlanticR/bioRworkshops.git - Project directory name: bioRworkshops The full repository to create this flashboard is in the Atlantic R GitHub site: https://github.com/AtlanticR/bioRworkshops/tree/master/16_ToolsScienceAdvice Step 5: Create your own dashboard and share (!) - Inventory of shiny apps and dashboards: https://docs.google.com/spreadsheets/d/1teh5CWZHJaJamUPVLxgDMtiFh3PlOSOT/edit#gid=769397193 ### Agenda

Agenda for workshop on November 5th 2019 distributed to workshop participants: https://docs.google.com/spreadsheets/d/1rWqus06dRR5TQfTOwpfq9Ul862BvzZ7rG5qXJOSuC-s/edit#gid=0 ### Pre-workshop material: Shiny!

**Intro to Shiny Apps** Chantelle Layton & Clark Richards led a workshop at BIO to learn about Shiny apps in R. Shiny takes a fresh, interactive approach to telling your data story. - The code used in this workshop is in the Atlantic R GitHub site: https://github.com/AtlanticR/bioRworkshops/tree/master/14_Shiny_intro - To watch the recording of this workshop, use Internet explorer and this link below: https://drive.google.com/file/d/1lk-gNbqdhpXEJKNaljfqI1oZFVev2i-L/view - Code repo for this workshop is here: https://github.com/AtlanticR/bioRworkshops/tree/master/14_Shiny_intro - Explore the onventory of shiny apps and dashboards under-development with contirbutions from DFO colleagues: https://docs.google.com/spreadsheets/d/1teh5CWZHJaJamUPVLxgDMtiFh3PlOSOT/edit#gid=769397193 Map {data-icon="fa-map"} ======================================= Column {.sidebar} ------------------------------------- ### Inputs ```{r} filter_select("MISSION", "Mission", shared_rv, ~MISSION) filter_select("COMM", "Species", shared_rv, ~COMM) ``` Column {.tabset} ------------------------------------- ### Map connected to filters ```{r} p <- plot_geo(data = shared_rv, x = ~LONGITUDE, y = ~LATITUDE, color = ~COMM, size = ~TOTWGT, sizes = c(10, 500), colors = viridis::viridis(3)) %>% add_markers() %>% layout(geo = list(resolution = 50, showland = TRUE, landcolor = toRGB("grey90"), coastlinecolor = toRGB("grey80"), projection = list(type = "mercator"), lonaxis = list(range = c(-75, -45)), lataxis = list(range = c(40, 50)))) p ``` ### Leaflet map ```{r} leaflet(shared_rv) %>% addTiles() %>% addCircleMarkers(stroke = FALSE, fillOpacity = 0.5, radius = 3, color = ~viridis::viridis(3)[factor(COMM)]) ``` ### Animated map using the plotly frame argument ```{r} p <- plot_geo(data = rv, x = ~LONGITUDE, y = ~LATITUDE, color = ~COMM, frame = ~YEAR, size = ~TOTWGT, sizes = c(10, 500), colors = viridis::viridis(3)) %>% add_markers() %>% layout(geo = list(resolution = 50, showland = TRUE, landcolor = toRGB("grey90"), coastlinecolor = toRGB("grey80"), projection = list(type = "mercator"), lonaxis = list(range = c(-75, -45)), lataxis = list(range = c(40, 50)))) %>% highlight(persisten = TRUE, off = "plotly_relayout") p ``` Plots {data-icon="fa-signal"} ======================================= Column ------------------------------------- ### Temperature ```{r} plot_ly(data = shared_rv) %>% add_markers(x = ~BOTTOM_TEMPERATURE, y = ~SURFACE_TEMPERATURE, color = ~COMM, colors = viridis::viridis(3), size = ~TOTWGT, sizes = c(10, 500)) %>% highlight(persisten = TRUE, off = "plotly_relayout") ``` > Markers sized based on total weight captured Data {data-icon="fa-database"} ======================================= Column ------------------------------------- ### Results ```{r} DT::datatable(shared_rv, extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = c('csv', 'excel'))) ``` Participant evaluation {data-icon="fa-comment"} ======================================= Column -------------------------------------- **Summary of post-workshop evaluation results** Workshop participants were asked to complete an evaluation survey at the end of the workshop. Of the 29 attendees, 19 responses were received (65% response rate). Responses were received from participants in the four Science divisions (Figure 1). Participants were asked to rate the workshop on various factors on a scale of 0-5 (low to high). The minimum rating for any question was 3, and average ratings were all above 4 (Figure 2). All survey respondents answered that they would recommend this workshop to others. 12 respondents provided comments. They highlighted: * the content was interesting and was highly applicable to their work activities * they enjoyed engaging with others outside their normal workgroup * they felt they learned a lot All survey respondents answered that they would try the techniques used in the course. 10 respondents provided comments. They highlighted: * the communication value of using dashboards with stakeholders or in CSAS processes to improve comprehension and transparency * the efficiency of using dashboards to explore and quality control data There were 8 responses to the question "What were you hoping to learn in this workshop that you did not?" Responses included: * mapping * presentation methods * integrating Shiny into a dashboard format * more examples and more time to practice Participants were asked for suggestions of topics for future workshops. The 8 responses highlighted: * cloud computing with RStudio * Shiny * spatial modelling/analysis * Github * R package development * integrating work between units/divisions Survey respondents reported that they would be most available for future workshops between November and March (Figure 3). Column -------------------------------------- ### Figure 1. Survey responses by science division. ```{r, echo=F, fig.align='center'} eval <- read.csv("workshop_evaluation.csv") q1 <- data.frame(table(eval[, 2])) levels(q1$Var1) <- c("CESD", "OESD", "ODIS", "PED") p <- ggplot() + geom_bar(data=q1, aes(Var1, Freq), stat="identity") + theme_classic() + xlab("What Science Division are you in?") + ylab("Number of respondents") ggplotly(p) ``` ### Figure 2. Summary of responses to rating questions. Each rating question was answered by 19 respondents. ```{r, echo=F, fig.align='center'} ratings <- eval[, c(1,3:10)] ratings <- melt(ratings, id.vars = "Timestamp") ratings$variable <- as.factor(gsub(ratings$variable, pattern=".", replacement =" ", fixed=T)) ratings$variable <- as.factor(gsub(ratings$variable, pattern=" ", replacement =" ", fixed=T)) ratings$value <- as.numeric(ratings$value) numbering <- c("4. ", "6. ", "2. ", "7. ", "8. ", "1. ", "3. ", "5. ") levels(ratings$variable) <- paste0(numbering, levels(ratings$variable)) ratings$variable <- as.factor(as.character(ratings$variable)) ratings_avg <- ddply(.data=ratings, .(variable), summarize, mean_rating = mean(value)) ratings$variable <- fct_rev(ratings$variable) ggplotly(ggplot() + geom_boxplot(data=ratings, aes(variable, value)) + geom_point(data=ratings_avg, aes(variable, mean_rating))+ theme_classic() + xlab(NULL) + ylab("Rating from low to high") + ylim(0,5) + coord_flip()) ``` ### Figure 3. Participant availability by month. ```{r, echo=F, fig.align='center'} whichmonths <- eval[, c(1,17)] df <- data.frame(month=format(ISOdatetime(2000,1:12,1,0,0,0),"%b"), num=1:12, count=NA) for (i in 1:12){ df[df$month == format(ISOdatetime(2000,1:12,1,0,0,0),"%b")[i],]$count <- length(grep(whichmonths[,2], pattern=format(ISOdatetime(2000,1:12,1,0,0,0),"%b")[i])) } ggplotly(ggplot() + geom_bar(data=df, aes(fct_reorder(month, num), count), stat="identity") + theme_classic() + xlab("Month") + ylab("Number of respondents")) ```